function request(args) {
  // 后端本地测试环境
  // const default_url1 = 'https://yrzj1.cpolar.top/api/';
  // const default_url1 = 'https://api.hfszzx.com/api/';
  // const default_url1 = 'https://www.zzl.mkxzuji.cn/api/'; //线上
  const default_url1 = "http://192.168.10.128:8081/api/"; //本地
  let {
    baseUrl2,
    url,
    method,
    data,
    methodType
  } = args;
  const default_url = baseUrl2 || default_url1;
  let Url = default_url + url;
  url = default_url.concat(url);
  data = data ? data : {};
  methodType = methodType == "application" ? "application/x-www-form-urlencoded" : "application/json;charset=utf-8";
  method = method || 'GET'

  if (method == "POST") {
    // methonType = "application/x-www-form-urlencoded";
  } else if (method == "GET") {
    // GET 请求缓存处理
    let timestamp = new Date().getTime()
    url = url + "?t=" + timestamp
  }

  let userInfo = my.getStorageSync({
    key: 'user'
  });
  // userInfo.data.id = 1150446
  let user = userInfo.data ? encodeURIComponent(JSON.stringify(userInfo.data)) : ''
  //验证基础库
  if (my.request) {
    return new Promise((resolve, reject) => {
      my.request({
        url: url,
        method: method,
        headers: {
          // "token": encodeURIComponent(JSON.stringify(token)),
          // "token": token,
          "user": user,
          'content-type': methodType
        },
        data: data,
        success: (res) => {
          console.log("Url======>>", Url, res)
          console.log("msg======>>", Url, res.data.msg)
          switch (res.data.code) {
            case 200:
              resolve(res.data)
              break;
            case 102:
              my.showToast({
                content: res.data.msg
              });
              reject(res.data)
              break;
            case 403:
              my.showToast({
                content: res.data.msg
              });
              my.removeStorageSync({
                key: 'user',
              });
              reject(res.data)
              break;
            default:
              args.hiddenTip || my.showToast({
                content: res.data.msg
              });
              reject(res.data)
              break;
          }
        },
        fail(res) {
          console.log("===========>>失败", res)
          args.hiddenTip || my.showToast({
            // centent: res.data.msg,
            duration: 1000,
          });
        },
      })
    })
  }
}
export default request